package cn.com.duiba.quanyi.open.demo.utils;

import java.util.Random;

/**
 * @author zzy
 * @create 2023/09/28 09:34
 **/
public class RandomStringGenerator {

    private static final String SEED = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    private static Random random = new Random();

    private RandomStringGenerator() {
    }

    /**
     * 生成随机字符串
     */
    public static String genString(int len) {
        StringBuilder randomString = new StringBuilder();
        for (int i = 0; i < len; i++) {
            int randomIndex = random.nextInt(SEED.length());
            randomString.append(SEED.charAt(randomIndex));
        }
        return randomString.toString();
    }

}
